/*
 * MIT License
 *
 * Copyright (c) 2024-2048 冰羽
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package cn.star.framework.core;

import cn.hutool.core.date.DateUtil;
import java.util.Date;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.Ansi.Attribute;
import org.fusesource.jansi.Ansi.Color;

/**
 * Constant<br>
 *
 * @author zhaoweiping
 *     <p style='color: red'>Created on 2024-09-23 11:06:00
 * @since 3.0.0
 */
public class Constant {

  /** 版本 */
  public static final String VERSION = "3.0.0";

  /** 基础包名 */
  public static final String BASE_PACKAGE = "cn.star";

  /**
   * 配置前缀<br>
   * 主要用于[.yml, .properties]配置文件
   */
  public static final String CONFIGURATION_PREFIX = "star";

  /** 作者信息 */
  public static final String AUTHOR = "zhaoweiping";

  /**
   * 获取当前时间
   *
   * @return
   */
  public static String getCurrentDateTime() {
    return DateUtil.formatDateTime(new Date());
  }

  /** 版本号 */
  public static final String SINCE = VERSION;

  /**
   * 颜色<br>
   * 字体颜色、背景颜色、字体风格(下划线、斜体...)<br>
   * {@link Ansi#a}/{@link Attribute}/{@link Color}<br>
   */
  public static Ansi getAnsi() {
    return Ansi.ansi();
  }

  /**
   * 颜色<br>
   * 支持默认字体{@link Color}<br>
   */
  public static Ansi getAnsi(Color fontColor) {
    return Ansi.ansi().fg(fontColor);
  }

  /** 空值 */
  public static final String EMPTY = "";

  /** 演示环境配置标识 */
  public static final String DEMO_ENVIRONMENT = "DEMO";

  // number

  public static final int NUMBER_ZERO = 0;

  public static final int NUMBER_ONE = 1;
  public static final int NUMBER_TWO = 2;
  public static final int NUMBER_THREE = 3;
  public static final int NUMBER_THIRTEEN = 13;

  public static final int NUMBER_ONE_THOUSAND = 1000;

  // date format

  public static final String DATE_FORMAT = "yyyy-MM-dd";
  public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
  public static final String DATE_TIME_FULL_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";

  // string codes

  /** Api成功(通用) */
  public static final String API_SUCCESS_CODE = "200";

  /** Api失败(通用) */
  public static final String API_FAIL_CODE = "500";

  @Deprecated
  @SuppressWarnings(
      value = {
        "all", // 抑制所有类型的警告
        "unchecked", // 抑制未经检查的类型的转换警告
        "deprecation", // 抑制关于使用已过时的API的警告
        "rawtypes", // 抑制使用原始类型（未指定泛型类型）的警告
        "serial", // 抑制序列化相关警告
        "unused", // 抑制未使用的代码的警告
        "null", // 抑制可能的空指针的警告
        "cast", // 抑制强制类型转换的警告
        "fallthrough", // 抑制 switch 语句中 case 标签的掉落（fall-through）警告
        "debug", // 抑制调试代码相关的警告，不常见
        "finally", // 抑制 finally 块的警告，不常见
        "overrides", // 抑制覆盖方法的警告
        "package" // 抑制有关包的警告，不常见
      })
  public static final String SUPPRESS_WARNINGS_VALUES = "@SuppressWarnings values";
}
